ShopCtrl = {};
local this = ShopCtrl;

local gameObject;
local rectTransform;
local message;

function ShopCtrl.New()
    logWarn("ShopCtrl.New --->>>");
    return this;
end

function ShopCtrl.Awake()
    logWarn("ShopCtrl.Awake --->>>");
    panelMgr:CreatePanel('Shop',this.OnCreate);
end

function ShopCtrl.OnCreate(obj)
    gameObject = obj;
    rectTransform = gameObject:GetComponent('RectTransform');

    --设置RecTransform
    rectTransform.anchorMin = Vector2.New(0,0.5);
    rectTransform.anchorMax = Vector2.New(1,0.5);
    rectTransform.offsetMax = Vector2.New(0,781.6379);
    rectTransform.offsetMin = Vector2.zero;
    rectTransform.localScale = Vector3.one;
    rectTransform.localRotation = Quaternion.Euler(0,0,0);
    rectTransform.localPosition = Vector3.zero;


    UIEventEx.AddButtonClick(ShopPanel.CloseButton, function ()
        destroy(gameObject);
    end);

end

function ShopCtrl.OnClick(go)
    destroy(gameObject);
end

function ShopCtrl.Close()
    panelMgr:ClosePanel(CtrlNames.Shop)
end